package com.itzhihao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@TableName(value = "glgl_product")
public class Product extends BaseEntity {

    private static final long serialVersionUID = 1L;

   // 解决jackson序列化时传入前端Long类型缺失精度问题
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "prod_id",type = IdType.ASSIGN_ID)
    private Long Id;

    @TableField(value = "store_id")
    private Long storeId;

    @TableField(value = "cate")
    private Integer cate;

    @Max(value = 240,message = "最大保存240")
    @TableField(value = "prod_desc")
    private String prodDesc;

    @NotNull(message = "产品名称不能为空")
    private String name;

    @TableField(value = "mainimage")
    private String mainImage;

    @TableField(value = "subimages")
    private String subImages;

    private Integer sort;

    private Double price;

    private Integer stock;

    private Double discount;

    private Integer status;

    @TableField(value = "is_deleted")
    private Integer isDeleted;

}
